\hypertarget{group__hibernate__api}{
\section{Hibernate\_\-api}
\label{group__hibernate__api}\index{Hibernate\_\-api@{Hibernate\_\-api}}
}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__hibernate__api_ga3873ce415feec8470452234f5cff8252}{
\#define {\bfseries DELAY\_\-USECS}~95}
\label{group__hibernate__api_ga3873ce415feec8470452234f5cff8252}

\item 
\hypertarget{group__hibernate__api_ga3a15b9e4cfa1f6668b3bc5e324af42c0}{
\#define {\bfseries LOOP\_\-CYCLES}~3}
\label{group__hibernate__api_ga3a15b9e4cfa1f6668b3bc5e324af42c0}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__hibernate__api_gaeb4f0fb725b3f63bbf14c516217af5ef}{
void {\bfseries HibernateWriteComplete} (void)}
\label{group__hibernate__api_gaeb4f0fb725b3f63bbf14c516217af5ef}

\item 
void \hyperlink{group__hibernate__api_gab02c6310c5956e6e093a30b60c446e7a}{HibernateEnableExpClk} (unsigned long ulHibClk)
\item 
void \hyperlink{group__hibernate__api_gaa99ae3587e64aa2d59d208173f581427}{HibernateDisable} (void)
\item 
void \hyperlink{group__hibernate__api_gad8c547ba31c0124346d4bab7876bfeb0}{HibernateClockSelect} (unsigned long ulClockInput)
\item 
void \hyperlink{group__hibernate__api_gae17a0d8df9a8e3ab26b0395114681a3d}{HibernateRTCEnable} (void)
\item 
void \hyperlink{group__hibernate__api_ga2149eb6f01c46b8e0ddc5f2a730ea2ed}{HibernateRTCDisable} (void)
\item 
void \hyperlink{group__hibernate__api_ga063e194a083b60091b7a4f4b5c4f7964}{HibernateWakeSet} (unsigned long ulWakeFlags)
\item 
unsigned long \hyperlink{group__hibernate__api_ga270b767aa77baa65d3ae201662f6ba62}{HibernateWakeGet} (void)
\item 
void \hyperlink{group__hibernate__api_gafd5350e24429c4af524f2815b4234bdb}{HibernateLowBatSet} (unsigned long ulLowBatFlags)
\item 
unsigned long \hyperlink{group__hibernate__api_gad495a1425c40c2c51521fad4505c2fad}{HibernateLowBatGet} (void)
\item 
void \hyperlink{group__hibernate__api_ga4d664e77ac853026ba374985c6396f68}{HibernateRTCSet} (unsigned long ulRTCValue)
\item 
unsigned long \hyperlink{group__hibernate__api_ga292374293a909784262ad00e29cd7c71}{HibernateRTCGet} (void)
\item 
void \hyperlink{group__hibernate__api_gaee98a5b9562313c53ea2700f12b3f609}{HibernateRTCMatch0Set} (unsigned long ulMatch)
\item 
unsigned long \hyperlink{group__hibernate__api_ga3d39de0e90ac4f4ccb4cbb8fe6458a06}{HibernateRTCMatch0Get} (void)
\item 
void \hyperlink{group__hibernate__api_ga13bfecb5b33d66304529363583f704f2}{HibernateRTCMatch1Set} (unsigned long ulMatch)
\item 
unsigned long \hyperlink{group__hibernate__api_gaecda3022ae5532a23b71f3abcb675d52}{HibernateRTCMatch1Get} (void)
\item 
void \hyperlink{group__hibernate__api_ga6ad94a3e01c938be5a5875c2070a147a}{HibernateRTCTrimSet} (unsigned long ulTrim)
\item 
unsigned long \hyperlink{group__hibernate__api_ga4796449d080bcd2d4202bf38c8e3fa9c}{HibernateRTCTrimGet} (void)
\item 
void \hyperlink{group__hibernate__api_ga2a1582d11e8160cc08d7191f842c965a}{HibernateDataSet} (unsigned long $\ast$pulData, unsigned long ulCount)
\item 
void \hyperlink{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}{HibernateDataGet} (unsigned long $\ast$pulData, unsigned long ulCount)
\item 
void \hyperlink{group__hibernate__api_ga9b3277ea6364acee80abdd108c4fd650}{HibernateRequest} (void)
\item 
void \hyperlink{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{HibernateIntEnable} (unsigned long ulIntFlags)
\item 
void \hyperlink{group__hibernate__api_gab815450dfaef7010305bfab4876bd10b}{HibernateIntDisable} (unsigned long ulIntFlags)
\item 
void \hyperlink{group__hibernate__api_gaa9e238a3aca3b9977c285eecb8c40288}{HibernateIntRegister} (void($\ast$pfnHandler)(void))
\item 
void \hyperlink{group__hibernate__api_ga931ff617278af3b798d5dc4218955c67}{HibernateIntUnregister} (void)
\item 
unsigned long \hyperlink{group__hibernate__api_ga1588082cffa5a198b391dee8bb941828}{HibernateIntStatus} (tBoolean bMasked)
\item 
void \hyperlink{group__hibernate__api_ga1dd491f6ac32201336d4927766f63b6a}{HibernateIntClear} (unsigned long ulIntFlags)
\item 
unsigned int \hyperlink{group__hibernate__api_ga2ca7ab520a7f4232645be07e3bb8450e}{HibernateIsActive} (void)
\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{group__hibernate__api_gad8c547ba31c0124346d4bab7876bfeb0}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateClockSelect@{HibernateClockSelect}}
\index{HibernateClockSelect@{HibernateClockSelect}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateClockSelect}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateClockSelect (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulClockInput}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gad8c547ba31c0124346d4bab7876bfeb0}
Selects the clock input for the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em ulClockInput}]specifies the clock input.\end{DoxyParams}
Configures the clock input for the Hibernation module. The configuration option chosen depends entirely on hardware design. The clock input for the module will either be a 32.768 kHz oscillator or a 4.194304 MHz crystal. The {\itshape ulClockFlags\/} parameter must be one of the following:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-CLOCK\_\-SEL\_\-RAW} -\/ use the raw signal from a 32.768 kHz oscillator.
\item {\bfseries HIBERNATE\_\-CLOCK\_\-SEL\_\-DIV128} -\/ use the crystal input, divided by 128.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateDataGet@{HibernateDataGet}}
\index{HibernateDataGet@{HibernateDataGet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateDataGet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateDataGet (
\begin{DoxyParamCaption}
\item[{unsigned long $\ast$}]{ pulData, }
\item[{unsigned long}]{ ulCount}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}
Reads a set of data from the non-\/volatile memory of the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em pulData}]points to a location where the data that is read from the Hibernation module will be stored. \item[{\em ulCount}]is the count of 32-\/bit words to read.\end{DoxyParams}
Retrieves a set of data from the Hibernation module non-\/volatile memory that was previously stored with the \hyperlink{group__hibernate__api_ga2a1582d11e8160cc08d7191f842c965a}{HibernateDataSet()} function. The caller must ensure that {\itshape pulData\/} points to a large enough memory block to hold all the data that is read from the non-\/volatile memory.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga2a1582d11e8160cc08d7191f842c965a}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateDataSet@{HibernateDataSet}}
\index{HibernateDataSet@{HibernateDataSet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateDataSet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateDataSet (
\begin{DoxyParamCaption}
\item[{unsigned long $\ast$}]{ pulData, }
\item[{unsigned long}]{ ulCount}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga2a1582d11e8160cc08d7191f842c965a}
Stores data in the non-\/volatile memory of the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em pulData}]points to the data that the caller wants to store in the memory of the Hibernation module. \item[{\em ulCount}]is the count of 32-\/bit words to store.\end{DoxyParams}
Stores a set of data in the Hibernation module non-\/volatile memory. This memory will be preserved when the power to the processor is turned off, and can be used to store application state information which will be available when the processor wakes. Up to 64 32-\/bit words can be stored in the non-\/volatile memory. The data can be restored by calling the \hyperlink{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}{HibernateDataGet()} function.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gaa99ae3587e64aa2d59d208173f581427}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateDisable@{HibernateDisable}}
\index{HibernateDisable@{HibernateDisable}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateDisable}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateDisable (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gaa99ae3587e64aa2d59d208173f581427}
Disables the Hibernation module for operation.

Disables the Hibernation module for operation. After this function is called, none of the Hibernation module features are available.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gab02c6310c5956e6e093a30b60c446e7a}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateEnableExpClk@{HibernateEnableExpClk}}
\index{HibernateEnableExpClk@{HibernateEnableExpClk}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateEnableExpClk}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateEnableExpClk (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulHibClk}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gab02c6310c5956e6e093a30b60c446e7a}
Enables the Hibernation module for operation.


\begin{DoxyParams}{Parameters}
\item[{\em ulHibClk}]is the rate of the clock supplied to the Hibernation module.\end{DoxyParams}
Enables the Hibernation module for operation. This function should be called before any of the Hibernation module features are used.

The peripheral clock will be the same as the processor clock. This will be the value returned by \hyperlink{group__sysctl__api_ga7fd64f17ef7b589c51d72df5837f13eb}{SysCtlClockGet()}, or it can be explicitly hard-\/coded if it is constant and known (to save the code/execution overhead of a call to \hyperlink{group__sysctl__api_ga7fd64f17ef7b589c51d72df5837f13eb}{SysCtlClockGet()}).

This function replaces the original HibernateEnable() API and performs the same actions. A macro is provided in {\ttfamily \hyperlink{hibernate_8h_source}{hibernate.h}} to map the original API to this API.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga1dd491f6ac32201336d4927766f63b6a}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntClear@{HibernateIntClear}}
\index{HibernateIntClear@{HibernateIntClear}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntClear}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateIntClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga1dd491f6ac32201336d4927766f63b6a}
Clears pending interrupts from the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em ulIntFlags}]is the bit mask of the interrupts to be cleared.\end{DoxyParams}
Clears the specified interrupt sources. This must be done from within the interrupt handler or else the handler will be called again upon exit.

The {\itshape ulIntFlags\/} parameter has the same definition as the {\itshape ulIntFlags\/} parameter to the \hyperlink{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{HibernateIntEnable()} function.

\begin{DoxyNote}{Note}
Since there is a write buffer in the Cortex-\/M3 processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (since NVIC still sees the interrupt source asserted).
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gab815450dfaef7010305bfab4876bd10b}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntDisable@{HibernateIntDisable}}
\index{HibernateIntDisable@{HibernateIntDisable}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntDisable}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateIntDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gab815450dfaef7010305bfab4876bd10b}
Disables interrupts for the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em ulIntFlags}]is the bit mask of the interrupts to be disabled.\end{DoxyParams}
Disables the specified interrupt sources from the Hibernation module.

The {\itshape ulIntFlags\/} parameter has the same definition as the {\itshape ulIntFlags\/} parameter to the \hyperlink{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{HibernateIntEnable()} function.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntEnable@{HibernateIntEnable}}
\index{HibernateIntEnable@{HibernateIntEnable}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntEnable}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateIntEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}
Enables interrupts for the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em ulIntFlags}]is the bit mask of the interrupts to be enabled.\end{DoxyParams}
Enables the specified interrupt sources from the Hibernation module.

The {\itshape ulIntFlags\/} parameter must be the logical OR of any combination of the following:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-INT\_\-PIN\_\-WAKE} -\/ wake from pin interrupt
\item {\bfseries HIBERNATE\_\-INT\_\-LOW\_\-BAT} -\/ low battery interrupt
\item {\bfseries HIBERNATE\_\-INT\_\-RTC\_\-MATCH\_\-0} -\/ RTC match 0 interrupt
\item {\bfseries HIBERNATE\_\-INT\_\-RTC\_\-MATCH\_\-1} -\/ RTC match 1 interrupt
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gaa9e238a3aca3b9977c285eecb8c40288}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntRegister@{HibernateIntRegister}}
\index{HibernateIntRegister@{HibernateIntRegister}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntRegister}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateIntRegister (
\begin{DoxyParamCaption}
\item[{void($\ast$)(void)}]{ pfnHandler}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gaa9e238a3aca3b9977c285eecb8c40288}
Registers an interrupt handler for the Hibernation module interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em pfnHandler}]points to the function to be called when a hibernation interrupt occurs.\end{DoxyParams}
Registers the interrupt handler in the system interrupt controller. The interrupt is enabled at the global level, but individual interrupt sources must still be enabled with a call to \hyperlink{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{HibernateIntEnable()}.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga1588082cffa5a198b391dee8bb941828}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntStatus@{HibernateIntStatus}}
\index{HibernateIntStatus@{HibernateIntStatus}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntStatus}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateIntStatus (
\begin{DoxyParamCaption}
\item[{tBoolean}]{ bMasked}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga1588082cffa5a198b391dee8bb941828}
Gets the current interrupt status of the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em bMasked}]is false to retrieve the raw interrupt status, and true to retrieve the masked interrupt status.\end{DoxyParams}
Returns the interrupt status of the Hibernation module. The caller can use this to determine the cause of a hibernation interrupt. Either the masked or raw interrupt status can be returned.

\begin{DoxyReturn}{Returns}
Returns the interrupt status as a bit field with the values as described in the \hyperlink{group__hibernate__api_ga87f7ed234a0ab59d5db1fe98262d50da}{HibernateIntEnable()} function. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga931ff617278af3b798d5dc4218955c67}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIntUnregister@{HibernateIntUnregister}}
\index{HibernateIntUnregister@{HibernateIntUnregister}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIntUnregister}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateIntUnregister (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga931ff617278af3b798d5dc4218955c67}
Unregisters an interrupt handler for the Hibernation module interrupt.

Unregisters the interrupt handler in the system interrupt controller. The interrupt is disabled at the global level, and the interrupt handler will no longer be called.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga2ca7ab520a7f4232645be07e3bb8450e}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateIsActive@{HibernateIsActive}}
\index{HibernateIsActive@{HibernateIsActive}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateIsActive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int HibernateIsActive (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga2ca7ab520a7f4232645be07e3bb8450e}
Checks to see if the Hibernation module is already powered up.

This function queries the control register to determine if the module is already active. This function can be called at a power-\/on reset to help determine if the reset is due to a wake from hibernation or a cold start. If the Hibernation module is already active, then it does not need to be re-\/enabled and its status can be queried immediately.

The software application should also use the \hyperlink{group__hibernate__api_ga1588082cffa5a198b391dee8bb941828}{HibernateIntStatus()} function to read the raw interrupt status to determine the cause of the wake. The \hyperlink{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}{HibernateDataGet()} function can be used to restore state. These combinations of functions can be used by the software to determine if the processor is waking from hibernation and the appropriate action to take as a result.

\begin{DoxyReturn}{Returns}
Returns {\bfseries true} if the module is already active, and {\bfseries false} if not. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gad495a1425c40c2c51521fad4505c2fad}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateLowBatGet@{HibernateLowBatGet}}
\index{HibernateLowBatGet@{HibernateLowBatGet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateLowBatGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateLowBatGet (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gad495a1425c40c2c51521fad4505c2fad}
Gets the currently configured low battery detection behavior.

Returns a value representing the currently configured low battery detection behavior. The return value will be one of the following:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-LOW\_\-BAT\_\-DETECT} -\/ detect a low battery condition.
\item {\bfseries HIBERNATE\_\-LOW\_\-BAT\_\-ABORT} -\/ detect a low battery condition, and abort hibernation if low battery is detected.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
Returns a value indicating the configured low battery detection. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gafd5350e24429c4af524f2815b4234bdb}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateLowBatSet@{HibernateLowBatSet}}
\index{HibernateLowBatSet@{HibernateLowBatSet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateLowBatSet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateLowBatSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulLowBatFlags}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gafd5350e24429c4af524f2815b4234bdb}
Configures the low battery detection.


\begin{DoxyParams}{Parameters}
\item[{\em ulLowBatFlags}]specifies behavior of low battery detection.\end{DoxyParams}
Enables the low battery detection and whether hibernation is allowed if a low battery is detected. If low battery detection is enabled, then a low battery condition will be indicated in the raw interrupt status register, and can also trigger an interrupt. Optionally, hibernation can be aborted if a low battery is detected.

The {\itshape ulLowBatFlags\/} parameter is one of the following values:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-LOW\_\-BAT\_\-DETECT} -\/ detect a low battery condition.
\item {\bfseries HIBERNATE\_\-LOW\_\-BAT\_\-ABORT} -\/ detect a low battery condition, and abort hibernation if low battery is detected.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga9b3277ea6364acee80abdd108c4fd650}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRequest@{HibernateRequest}}
\index{HibernateRequest@{HibernateRequest}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRequest}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRequest (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga9b3277ea6364acee80abdd108c4fd650}
Requests hibernation mode.

This function requests the Hibernation module to disable the external regulator, thus removing power from the processor and all peripherals. The Hibernation module will remain powered from the battery or auxiliary power supply.

The Hibernation module will re-\/enable the external regulator when one of the configured wake conditions occurs (such as RTC match or external {\bfseries WAKE} pin). When the power is restored the processor will go through a normal power-\/on reset. The processor can retrieve saved state information with the \hyperlink{group__hibernate__api_ga6ca9598039c0c446f975a8f74f3cd5d8}{HibernateDataGet()} function. Prior to calling the function to request hibernation mode, the conditions for waking must have already been set by using the \hyperlink{group__hibernate__api_ga063e194a083b60091b7a4f4b5c4f7964}{HibernateWakeSet()} function.

Note that this function may return because some time may elapse before the power is actually removed, or it may not be removed at all. For this reason, the processor will continue to execute instructions for some time and the caller should be prepared for this function to return. There are various reasons why the power may not be removed. For example, if the \hyperlink{group__hibernate__api_gafd5350e24429c4af524f2815b4234bdb}{HibernateLowBatSet()} function was used to configure an abort if low battery is detected, then the power will not be removed if the battery voltage is too low. There may be other reasons, related to the external circuit design, that a request for hibernation may not actually occur.

For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga2149eb6f01c46b8e0ddc5f2a730ea2ed}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCDisable@{HibernateRTCDisable}}
\index{HibernateRTCDisable@{HibernateRTCDisable}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCDisable}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCDisable (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga2149eb6f01c46b8e0ddc5f2a730ea2ed}
Disables the RTC feature of the Hibernation module.

Disables the RTC in the Hibernation module. After calling this function the RTC features of the Hibernation module will not be available.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gae17a0d8df9a8e3ab26b0395114681a3d}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCEnable@{HibernateRTCEnable}}
\index{HibernateRTCEnable@{HibernateRTCEnable}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCEnable}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCEnable (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gae17a0d8df9a8e3ab26b0395114681a3d}
Enables the RTC feature of the Hibernation module.

Enables the RTC in the Hibernation module. The RTC can be used to wake the processor from hibernation at a certain time, or to generate interrupts at certain times. This function must be called before using any of the RTC features of the Hibernation module.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga292374293a909784262ad00e29cd7c71}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCGet@{HibernateRTCGet}}
\index{HibernateRTCGet@{HibernateRTCGet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateRTCGet (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga292374293a909784262ad00e29cd7c71}
Gets the value of the real time clock (RTC) counter.

Gets the value of the RTC and returns it to the caller.

\begin{DoxyReturn}{Returns}
Returns the value of the RTC. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga3d39de0e90ac4f4ccb4cbb8fe6458a06}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCMatch0Get@{HibernateRTCMatch0Get}}
\index{HibernateRTCMatch0Get@{HibernateRTCMatch0Get}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCMatch0Get}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateRTCMatch0Get (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga3d39de0e90ac4f4ccb4cbb8fe6458a06}
Gets the value of the RTC match 0 register.

Gets the value of the match 0 register for the RTC.

\begin{DoxyReturn}{Returns}
Returns the value of the match register. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gaee98a5b9562313c53ea2700f12b3f609}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCMatch0Set@{HibernateRTCMatch0Set}}
\index{HibernateRTCMatch0Set@{HibernateRTCMatch0Set}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCMatch0Set}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCMatch0Set (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulMatch}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gaee98a5b9562313c53ea2700f12b3f609}
Sets the value of the RTC match 0 register.


\begin{DoxyParams}{Parameters}
\item[{\em ulMatch}]is the value for the match register.\end{DoxyParams}
Sets the match 0 register for the RTC. The Hibernation module can be configured to wake from hibernation, and/or generate an interrupt when the value of the RTC counter is the same as the match register.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_gaecda3022ae5532a23b71f3abcb675d52}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCMatch1Get@{HibernateRTCMatch1Get}}
\index{HibernateRTCMatch1Get@{HibernateRTCMatch1Get}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCMatch1Get}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateRTCMatch1Get (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_gaecda3022ae5532a23b71f3abcb675d52}
Gets the value of the RTC match 1 register.

Gets the value of the match 1 register for the RTC.

\begin{DoxyReturn}{Returns}
Returns the value of the match register. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga13bfecb5b33d66304529363583f704f2}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCMatch1Set@{HibernateRTCMatch1Set}}
\index{HibernateRTCMatch1Set@{HibernateRTCMatch1Set}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCMatch1Set}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCMatch1Set (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulMatch}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga13bfecb5b33d66304529363583f704f2}
Sets the value of the RTC match 1 register.


\begin{DoxyParams}{Parameters}
\item[{\em ulMatch}]is the value for the match register.\end{DoxyParams}
Sets the match 1 register for the RTC. The Hibernation module can be configured to wake from hibernation, and/or generate an interrupt when the value of the RTC counter is the same as the match register.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga4d664e77ac853026ba374985c6396f68}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCSet@{HibernateRTCSet}}
\index{HibernateRTCSet@{HibernateRTCSet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCSet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulRTCValue}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga4d664e77ac853026ba374985c6396f68}
Sets the value of the real time clock (RTC) counter.


\begin{DoxyParams}{Parameters}
\item[{\em ulRTCValue}]is the new value for the RTC.\end{DoxyParams}
Sets the value of the RTC. The RTC will count seconds if the hardware is configured correctly. The RTC must be enabled by calling \hyperlink{group__hibernate__api_gae17a0d8df9a8e3ab26b0395114681a3d}{HibernateRTCEnable()} before calling this function.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga4796449d080bcd2d4202bf38c8e3fa9c}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCTrimGet@{HibernateRTCTrimGet}}
\index{HibernateRTCTrimGet@{HibernateRTCTrimGet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCTrimGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateRTCTrimGet (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga4796449d080bcd2d4202bf38c8e3fa9c}
Gets the value of the RTC predivider trim register.

Gets the value of the pre-\/divider trim register. This function can be used to get the current value of the trim register prior to making an adjustment by using the \hyperlink{group__hibernate__api_ga6ad94a3e01c938be5a5875c2070a147a}{HibernateRTCTrimSet()} function.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga6ad94a3e01c938be5a5875c2070a147a}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateRTCTrimSet@{HibernateRTCTrimSet}}
\index{HibernateRTCTrimSet@{HibernateRTCTrimSet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateRTCTrimSet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateRTCTrimSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulTrim}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga6ad94a3e01c938be5a5875c2070a147a}
Sets the value of the RTC predivider trim register.


\begin{DoxyParams}{Parameters}
\item[{\em ulTrim}]is the new value for the pre-\/divider trim register.\end{DoxyParams}
Sets the value of the pre-\/divider trim register. The input time source is divided by the pre-\/divider to achieve a one-\/second clock rate. Once every 64 seconds, the value of the pre-\/divider trim register is applied to the predivider to allow fine-\/tuning of the RTC rate, in order to make corrections to the rate. The software application can make adjustments to the predivider trim register to account for variations in the accuracy of the input time source. The nominal value is 0x7FFF, and it can be adjusted up or down in order to fine-\/tune the RTC rate.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga270b767aa77baa65d3ae201662f6ba62}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateWakeGet@{HibernateWakeGet}}
\index{HibernateWakeGet@{HibernateWakeGet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateWakeGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long HibernateWakeGet (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga270b767aa77baa65d3ae201662f6ba62}
Gets the currently configured wake conditions for the Hibernation module.

Returns the flags representing the wake configuration for the Hibernation module. The return value will be a combination of the following flags:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-WAKE\_\-PIN} -\/ wake when the external wake pin is asserted.
\item {\bfseries HIBERNATE\_\-WAKE\_\-RTC} -\/ wake when one of the RTC matches occurs.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
Returns flags indicating the configured wake conditions. 
\end{DoxyReturn}
\hypertarget{group__hibernate__api_ga063e194a083b60091b7a4f4b5c4f7964}{
\index{hibernate\_\-api@{hibernate\_\-api}!HibernateWakeSet@{HibernateWakeSet}}
\index{HibernateWakeSet@{HibernateWakeSet}!hibernate_api@{hibernate\_\-api}}
\subsubsection[{HibernateWakeSet}]{\setlength{\rightskip}{0pt plus 5cm}void HibernateWakeSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulWakeFlags}
\end{DoxyParamCaption}
)}}
\label{group__hibernate__api_ga063e194a083b60091b7a4f4b5c4f7964}
Configures the wake conditions for the Hibernation module.


\begin{DoxyParams}{Parameters}
\item[{\em ulWakeFlags}]specifies which conditions should be used for waking.\end{DoxyParams}
Enables the conditions under which the Hibernation module will wake. The {\itshape ulWakeFlags\/} parameter is the logical OR of any combination of the following:


\begin{DoxyItemize}
\item {\bfseries HIBERNATE\_\-WAKE\_\-PIN} -\/ wake when the external wake pin is asserted.
\item {\bfseries HIBERNATE\_\-WAKE\_\-RTC} -\/ wake when one of the RTC matches occurs.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
